[#import "/framework/JGP.htm"  as JGP]
<!--
项目   jgp-cloud-parent
作者   LOUFEI [Gavin]
时间   2019-09-06
-->
[@JGP.head "添加数据"/]
[@JGP.body]
    <jgp-div _row="['30','*']" _runit="px">
        <div slot="1-1">
            <jgp-btn _id="save-btn" _form="form" _fn="saveCallbackFn">保存</jgp-btn>
        </div>
        <jgp-div slot="2-1" _row="['40','60']">
            <jgp-panel slot="1-1">

                <jgp-form _id="form" _label_width="80px" _render_form_id="${formId!''}" _render_form_code="${formCode!''}" _biz_id="${bizId!''}"></jgp-form>
            </jgp-panel>
            <jgp-panel _id="relationForm" slot="2-1" _default_tools="[]" :_title="data.busiFormTitle || '业务表单'" _url="${relation!'javascript:void(0);'}?editFlag=${editFlag?c}"
                       _onload="busiFormLoadedCallback"></jgp-panel>
        </jgp-div>
    </jgp-div>
[/@JGP.body]

[@JGP.foot]
    <script>
        var editFlag = ${editFlag?c};
        JGP.$onload(function () {
            if(!editFlag){
                JGP.form('form').attr('readonly',true);
                JGP.btn('save-btn').attr("_disabled",true);
            }
        })
        function saveCallbackFn(result) {
            var contentWindow = JGP.panel('relationForm').contentWindow()
            contentWindow.save(function (flag) {
                if(result.back.flag){
                    JGP.$close(true);
                }
            })
        }
        function busiFormLoadedCallback(result){
            var iframe = result.back.el;
            var busiFormTitle = iframe.contentWindow.document.title;
            JGP.$putData("busiFormTitle",busiFormTitle);
        }
    </script>
[/@JGP.foot]